1. Field of the Invention
The present invention generally relates to sort/merge processors. More particularly, the present invention relates to an apparatus which executes sorting and merging data records, satisfying both given record extraction criteria and specified record reformatting rules at the same time, as well as being applicable to a wide range of file handling programs including sort or merge operations.
2. Description of the Related Art
Today""s computerized business activities, such as the operations of financial online systems, involve daily data collection and processing tasks. The collected data records are subjected to various processes, including filtering, sorting, and reformatting, under predetermined processing rules. Usually, those routine tasks are accomplished through the use of so-called sort/merge programs. Conventionally, this kind of sort/merge programs provide such functions as extraction and reformatting of records, besides supporting various file systems. The program processes each input file with some specific conditions suitable for that file.
FIG. 12 is a flowchart showing a process flow of conventional sort/merge programs. This process first chooses an appropriate file system that is suitable for input files to be processed (step S1). Then source data is read out of the input files through the selected file system (step S2). Relevant records are extracted according to some given record extraction criteria (step S3), and reformatted as specified in a predetermined record reformatting rule (step S4). This step S4 may be skipped when no record reformatting rules are specified. The extracted and reformatted records are subjected to sort and merge processing (step S5). The above steps S2 to S5 are repeated until all input files are processed and the End of Data (EOD) is indicated. Lastly, the resultant records are written into an output file (step S6).
A more specific example process will now be explained below, assuming that two input files are to be sorted and merged on different file systems and record extraction criteria. FIGS. 13(A) to 13(C) show three processing stages of a conventional sort/merge process. Suppose here that the two input files 1 and 2 have the following requirements. The first input file 1 needs a file system that handles a standard file format, and sort/merge operations should be performed under a first record extraction criterion. The second input file 2, on the other hand, requires another file system that can handle the Common Business Oriented Language (COBOL) index file format. Sort/merge operations should be performed under a second record extraction criterion. With those conditions and rules, the processor sorts and merges the two files in the following way.
Referring to FIG. 13(A), the first stage is shown. As explained in the flowchart of FIG. 12, the processor reads the first input file 1 through the standard file system, extracts relevant records that meet the first record extraction criterion, sorts the extracted records, and saves them into a first intermediate file 3. Referring next to FIG. 13(B), the second stage proceeds similarly to the first stage. That is, the processor reads the second input file 2 through the COBOL index file system, extracts relevant records that meet the second record extraction criterion, sorts the extracted records, and saves them into a second intermediate file 4. The above first and second intermediate files 3 and 4 are created in the standard file format. Referring to FIG. 13(C), the third stage is shown. The processor reads out records from the first and second intermediate files 3 and 4, sorts and merges all the records, and write them into an output file 5.
As seen from the above, the conventional sort/merge processor has to process data files individually at separate job stages and then merge the results, because they require different file systems and different record extraction criteria. Such job stages are executed by giving appropriate commands to the sort/merge processor. For example, the command script used in the three stages shown in FIGS. 13(A) to 13(C) is as follows.
Here, xe2x80x9cbsortxe2x80x9d is a command to execute sort/merge processing, which is followed by some command options each beginning with a minus sign (xe2x80x9cxe2x88x92xe2x80x9d). The options include: xe2x80x9cxe2x88x92sxe2x80x9d (sort switch), xe2x80x9cxe2x88x92mxe2x80x9d (merge switch), xe2x80x9cxe2x88x92oxe2x80x9d (output file name), xe2x80x9cxe2x88x92pxe2x80x9d (record extraction switch), xe2x80x9cxe2x88x92zxe2x80x9d (record length), and xe2x80x9cxe2x88x92Fxe2x80x9d (output file system and input file system).
More specifically, the above commands specify the following things. The first stage command requests the processor to read the first input file 1 (xe2x80x9cinfile1xe2x80x9d) using the default file system, extract records, and sort them into a first intermediate file 3 (xe2x80x9cintermediatefile1xe2x80x9d). When extracting relevant records, the processor is to search for such records that contain a 4-byte ASCII character string xe2x80x9ctestxe2x80x9d starting at the eleventh byte (i.e., byte #10). At the second stage, a different record extraction criterion is specified. In addition, the processor is requested to use the standard disk operating system (DOS) file system (xe2x80x9cdosfsxe2x80x9d) when writing an output file, and the COBOL index file system (xe2x80x9ccobidxxe2x80x9d) when reading input files. The third stage command requests the processor to read the two intermediate files 3 and 4 (xe2x80x9cintermediatefile1,xe2x80x9d xe2x80x9cintermediatefile2xe2x80x9d), merge them together, and write the result in to an output file 5 (xe2x80x9coutfilexe2x80x9d).
As seen from the above example command script, the conventional sort/merge processor requires the user to add a new job step each time he/she encounters a different kind of input files in terms of source file systems, record extraction criteria, and record reformatting rules. This means that the processor must execute sorting and merging as many times as the number of different conditions, causing a problem of low processing efficiency.
Taking the above into consideration, an object of the present invention is to provide a sort/merge processing apparatus which accepts at a time a variety of processing options for multiple input files, including different record extraction criteria, different record reformatting rules, and different file system designations.
To accomplish the above object, according to the present invention, there is provided an apparatus for sorting and merging records contained in a plurality of input files in accordance with predefined conditions. This apparatus comprises the following elements: a group profile identification unit which accepts a command containing group profile specifications, and identifies record extraction criteria for individual groups of input files by parsing the group profile specifications contained in the command; an extraction criteria setting unit which sets up one of the identified record extraction criteria that is required to process input files belonging to a specific group; a file reading unit which reads out records from the input files; a record extraction processor which extracts, out of the records read out from the input files, such records that are relevant to the record extraction criterion set up by the extraction criteria setting unit; a sort/merge execution unit which executes a sort/merge operation to the extracted records; and a file writing unit which writes the sorted and/or merged records to an output file.
The above and other objects, features and advantages of the present invention will become apparent from the following description when taken in conjunction with the accompanying drawings which illustrate preferred embodiments of the present invention by way of example.